import { useLocation } from 'react-router';
import { routes } from '~/config/routes';
import { pageInterceptorService } from '.';

export const PageInterceptor = () => {
  const location = useLocation();

  const url = location.pathname;

  const current = {
    pageId: 0,
  };

  routes.forEach((v) => {
    if (v.path === url) {
      current.pageId = v.id;
    }
  });

  pageInterceptorService.report();
  return null;
};
